Binary targets
Rust
プロジェクト中で、コンパイル後即座に実行可能な単体のファイル
(デフォルトでmain.rs)
即座に実行したいrsファイルを設定する
src/binに入れておけば、それらもプロジェクト中のbinary targetsになる。
cargo run --binのあとにファイル名(拡張子抜きのターゲット名)を記述すれば実行できる
src/bin/**/*.rsのようなフォルダはどうなる?
If a binary, example, bench, or integration test consists of multiple source files, place a main.rs file along with the extra modules within a subdirectory of the src/bin, examples, benches, or tests directory. The name of the executable will be the directory name.
https://doc.rust-lang.org/cargo/guide/project-layout.html
複数ファイルを要するBinary targetになる。
フォルダの名前がそのままターゲット名として扱われる。
https://doc.rust-lang.org/cargo/reference/cargo-targets.html#binaries